<template>
  <div class="wrap">
    <div class="center">
      <div>
        <img class="hy520" src="../assets/hy520.png" alt />
      </div>
      <div class="box">
        <div class="hy">
          <img src="../assets/code.jpg" class="loginLogo" alt srcset />
          <h3>登陆手机端管理订单</h3>
        </div>
        <div class="form">
          <div class="first">
            <p class="active">登陆</p>
            <p @click="register">注册</p>
          </div>
          <div class="item">
            <img src="../assets/loginPhone.png" alt />
            <input type="text" v-model="account" placeholder="请输入账号" />
          </div>
          <div class="item">
            <img src="../assets/pass.png" alt />
            <input v-model="password" type="text" @focus="changeType" placeholder="请输入密码" />
          </div>
          <p class="ccc">登陆即代表你同意<span style="color:rgb(85,178,252)" @click="dialogVisible=true">《捷报订单许可及服务协议》</span></p>
          <div class="bok">
            <p @click="login">登陆</p>
            <!-- <p @click="register">注册</p> -->
            <el-link type="primary" @click="wjmm">忘记密码</el-link>
          </div>
        </div>
      </div>
    </div>
    <img src="../assets/hy.png" class="bg" alt />
    <xiyi :dialogVisible="dialogVisible" @close="close"/>
  </div>
</template>
<style scoped lang="scss">
.first{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  p{
    margin-left: 20px;
    color: #719bef;
    line-height: 30px;
    cursor: pointer;
  }
  .active{
    margin-top: 4px;
  }
  .active::after{
    content: "";
    display: block;
    height: 4px;
    background:#719bef ;
    border-radius: 10px;
  }
}
.ccc{
    font-size: 12px;
    width: 100%;
    line-height: 30px;
    span{
      cursor: pointer;
    }
}
.hy520 {
  width: 250px;
}
.box {
  display: flex;
  align-items: flex-start;
}
.wrap {
  position: relative;
  min-height: 720px;
  margin: 0 auto;
  min-width: 940px;
  .bg {
    width: 100%;
    min-height: 720px;
  }
  .hy {
    margin-top: 74px;
    margin-right: 30px;
  }
  .center {
    display: flex;
    justify-content: space-around;
    background: #fff;
    align-items: center;
    width: 74%;
    margin: 0 auto;
    .loginLogo {
      width: 125px;
    }
    h3 {
      color: #719bef;
      font-size: 12px;
      font-weight: normal;
      width: 125px;
      text-align: center;
    }
    .form {
      margin-top: 80px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      box-shadow: 0px 1px 4px rgba(222, 219, 219, 0.3),
        0px 0px 20px rgba(0, 0, 0, 0.1);
      padding: 80px 50px;
      border-radius: 8px;
      .item {
        height: 60px;
        display: flex;
        align-items: center;
        border-bottom: 0.5px solid #719bef;
        width: 300px;
        margin-top: 20px;
        ::-webkit-input-placeholder {
          color: #719bef;
        }
        input {
          outline: none;
          background: transparent;
          border: none;
          display: block;
          margin-left: 15px;
          height: 100%;
          color: #719bef;
          font-size: 16px;
        }
        img {
          width: 20px;
        }
      }
      .bok {
        display: flex;
        align-items: center;
        margin-top: 50px;
        justify-content: space-between;
        width: 300px;
        p {
          width: 100px;
          height: 30px;
          border-radius: 30px;
          background: #719bef;
          text-align: center;
          line-height: 30px;
          color: #fff;
          cursor: pointer;
        }
        p:nth-of-type(2) {
          color: #719bef;
          border: 1px solid #719bef;
          background: #fff;
        }
      }
    }
  }
}
// @media screen and (max-width: 1054px) {
//   .bg {
//     display: none;
//   }
//   .wrap .center {
//     min-width: 400px;
//     position: static;
//     margin: 10% auto 0;
//   }
// }
</style>

<script>
import { login } from "../utils/interface";
import xiyi from './xiyi'
export default {
  components:{
    xiyi
  },
  data() {
    return {
      account: "",
      password: "",
      dialogVisible:false
    };
  },
  methods: {
    login() {
      if (!this.account) {
        this.$alert("请输入登陆账号", "提示", {
          confirmButtonText: "确定"
        });
        return false;
      }
      if (!this.password) {
        this.$alert("请输入密码", "提示", {
          confirmButtonText: "确定"
        });
        return false;
      }
      login({
        account: this.account,
        password: this.password
      }).then(res => {
        if (res.data.code == 200) {
          localStorage.setItem("shopPC", res.data.data.jsessionid);
          this.$router.push("/layout");
        }
      });
    },
    register() {
      this.$router.push("/register");
    },
    changeType(e) {
      e.srcElement.type = "password";
    },
    wjmm() {
      this.$router.push("/registerw");
    },
    close(){
      this.dialogVisible = false
    }
  }
};
</script>
